package com.wzh.house.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzh.common.utils.PageUtils;
import com.wzh.common.utils.Query;

import com.wzh.house.dao.NewUserAttentionDao;
import com.wzh.house.entity.NewUserAttentionEntity;
import com.wzh.house.service.NewUserAttentionService;


@Service("newUserAttentionService")
public class NewUserAttentionServiceImpl extends ServiceImpl<NewUserAttentionDao, NewUserAttentionEntity> implements NewUserAttentionService {

    @Autowired
    private NewUserAttentionDao newUserAttentionDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<NewUserAttentionEntity> page = this.page(
                new Query<NewUserAttentionEntity>().getPage(params),
                new QueryWrapper<NewUserAttentionEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public Integer getCountByNewAndUserId(Integer houseId, Integer userId) {
        return newUserAttentionDao.getCountByNewAndUserId(houseId,userId);
    }

    @Override
    public void del(NewUserAttentionEntity newUserAttention) {
       Integer i= newUserAttentionDao.del(newUserAttention.getNewId(),newUserAttention.getUserId());
    }

    @Override
    public void add(NewUserAttentionEntity newUserAttention) {
       Integer i = newUserAttentionDao.add(newUserAttention.getNewId(),newUserAttention.getUserId());
    }

}